import React, { Component } from 'react';
import BaseRadio from './Radio';
import RadioGruop from './RadioGroup';
import RadioButton from './RadioButton';
import classNames from 'classnames';
import './style/index.less';

export default class Radio extends Component {
  static Group = RadioGruop;
  static Button = RadioButton;
  static defaultProps = {
    prefixCls: 'ant-radio'
  }

  render() {
    const { prefixCls, children, checked, disabled, className = '', style } = this.props;
    const wrapperClassString = classNames({
      [`${prefixCls}-wrapper`]: true,
      [`${prefixCls}-wrapper-checked`]: checked,
      [`${prefixCls}-wrapper-disabled`]: disabled
    }, className);

    return (
      <label
        className={wrapperClassString}
        style={style}
        onMouseEnter={this.props.onMouseEnter}
        onMouseLeave={this.props.onMouseLeave}
      >
        <BaseRadio {...this.props} style={null} children={null} />
        {children !== undefined ? <span>{children}</span> : null}
      </label>
    );
  }
}
